package com.example.demo.alex.mapper;

import com.example.demo.alex.model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper

public interface UserMapper {
    @Select("select * from t_user where id={id}")

    User getUserbyId(@Param("id")Long id);

    @Select("select * from t_user")
    @Results(id="user1",value={
            @Result(column = "v_name", property = "name", javaType = String.class),
            @Result(property = "age", column = "v_age", javaType = String.class)
    }
    )
    List<User> getUserList();


    @Insert("insert into t_user values{#{id},#{name},#{age}}")
    int insert(User user);

}
